<template>
  <div class="order-collection">
    <div class="page-header">
      <h1>订单回款</h1>
      <div class="breadcrumb">财务管理 / 订单回款</div>
    </div>

    <div class="search-action-section">
      <div class="search-form">
        <div class="form-item">
          <label>订单类型</label>
          <select v-model="searchForm.orderType">
            <option value="">请选择</option>
            <option value="sales">销售单</option>
            <option value="return">退货单</option>
          </select>
        </div>
        <div class="form-item">
          <label>订单编号</label>
          <input v-model="searchForm.orderNumber" type="text" placeholder="请输入客户名称" />
        </div>
        <div class="form-item">
          <label>收款状态</label>
          <select v-model="searchForm.collectionStatus">
            <option value="">请选择</option>
            <option value="uncollected">未收款</option>
            <option value="partial">部分收款</option>
            <option value="collected">已收款</option>
          </select>
        </div>
        <div class="form-buttons">
          <button class="btn btn-primary" @click="searchOrders">查询</button>
          <button class="btn btn-secondary" @click="resetSearch">重置</button>
        </div>
      </div>

      <div class="action-buttons">
        <!-- 可以添加其他批量操作按钮 -->
      </div>
    </div>

    <div class="table-pagination-section">
      <div class="table-container">
        <table class="data-table">
          <thead>
            <tr>
              <th><input type="checkbox" v-model="selectAll" @change="toggleSelectAll" /></th>
              <th>订单类型</th>
              <th>订单编号</th>
              <th>销售/退货日期</th>
              <th>客户/供应商</th>
              <th>销售/采购退货负责人</th>
              <th>联系电话</th>
              <th>总金额 (元)</th>
              <th>待收款金额 (元)</th>
              <th>状态</th>
              <th>备注</th>
              <th>创建人</th>
              <th>创建时间</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="order in orderList" :key="order.id" :class="{ 'selected-row': order.selected }" @click="toggleRowSelect(order, $event)">
              <td><input type="checkbox" v-model="order.selected" @click.stop /></td>
              <td>{{ order.orderType }}</td>
              <td>{{ order.orderNumber }}</td>
              <td>{{ order.orderDate }}</td>
              <td>{{ order.customerName }}</td>
              <td>{{ order.responsiblePerson }}</td>
              <td>{{ order.contactPhone }}</td>
              <td>{{ order.totalAmount }}</td>
              <td>{{ order.pendingAmount }}</td>
              <td>
                <span :class="getStatusClass(order.status)">{{ order.statusText }}</span>
              </td>
              <td>{{ order.remark || '-' }}</td>
              <td>{{ order.creator }}</td>
              <td>{{ order.createTime }}</td>
              <td>
                <button class="btn btn-small btn-primary" @click="openCollectionModal(order)">
                  <span class="btn-icon">💰</span>
                  收款申请
                </button>
              </td>
            </tr>
          </tbody>
        </table>
      </div>

      <div class="pagination">
        <div class="pagination-info">共{{ totalPages }}页/{{ totalItems }}条数据</div>
        <div class="pagination-controls">
          <button class="btn btn-page" :disabled="currentPage === 1" @click="changePage(currentPage - 1)">上一页</button>
          <button v-for="page in visiblePages" :key="page" class="btn btn-page" :class="{ active: page === currentPage }" @click="changePage(page)">{{ page }}</button>
          <button class="btn btn-page" :disabled="currentPage === totalPages" @click="changePage(currentPage + 1)">下一页</button>
        </div>
        <div class="pagination-jump">
          <span>跳至</span>
          <input type="number" v-model="jumpPage" min="1" :max="totalPages" />
          <span>页</span>
          <button class="btn btn-small" @click="jumpToPage">确定</button>
        </div>
      </div>
    </div>

    <!-- 收款申请模态框 -->
    <div v-if="showCollectionModal" class="modal-overlay" @click="showCollectionModal = false">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h3>收款申请</h3>
          <button class="modal-close" @click="showCollectionModal = false">&times;</button>
        </div>
        <div class="modal-body">
          <!-- 订单信息区域 -->
          <div class="order-info-section">
            <h4>订单信息</h4>
            <div class="order-info-table">
              <div class="info-row">
                <div class="info-item">
                  <label>订单类型</label>
                  <span>{{ selectedOrder?.orderType || '-' }}</span>
                </div>
                <div class="info-item">
                  <label>订单编号</label>
                  <span>{{ selectedOrder?.orderNumber || '-' }}</span>
                </div>
              </div>
              <div class="info-row">
                <div class="info-item">
                  <label>采购/销售日期</label>
                  <span>{{ selectedOrder?.orderDate || '-' }}</span>
                </div>
                <div class="info-item">
                  <label>供应商/客户</label>
                  <span>{{ selectedOrder?.customerName || '-' }}</span>
                </div>
              </div>
              <div class="info-row">
                <div class="info-item">
                  <label>负责人</label>
                  <span>{{ selectedOrder?.responsiblePerson || '-' }}</span>
                </div>
                <div class="info-item">
                  <label>总金额(元)</label>
                  <span>{{ selectedOrder?.totalAmount || '-' }}</span>
                </div>
              </div>
              <div class="info-row">
                <div class="info-item">
                  <label>未收款金额(元)</label>
                  <span>{{ selectedOrder?.pendingAmount || '-' }}</span>
                </div>
                <div class="info-item">
                  <label></label>
                  <span></span>
                </div>
              </div>
            </div>
          </div>

          <!-- 收款详情区域 -->
          <div class="payment-details-section">
            <h4>收款详情</h4>
            <div class="form-group">
              <label class="required">收款金额</label>
              <input type="number" v-model="collectionForm.amount" placeholder="请输入" />
            </div>
            <div class="form-group">
              <label class="required">收款方式</label>
              <select v-model="collectionForm.method">
                <option value="">请选择</option>
                <option value="bank">银行转账</option>
                <option value="cash">现金</option>
                <option value="check">支票</option>
                <option value="wechat">微信支付</option>
                <option value="alipay">支付宝</option>
              </select>
            </div>
            <div class="form-group">
              <label class="required">收款日期</label>
              <input type="date" v-model="collectionForm.collectionDate" />
            </div>
            <div class="form-group">
              <label>备注</label>
              <input type="text" v-model="collectionForm.remark" placeholder="请输入" />
            </div>
          </div>


        </div>
        <div class="modal-footer">
          <button class="btn btn-secondary" @click="showCollectionModal = false">取消</button>
          <button class="btn btn-primary" @click="submitCollection">确认</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, computed, onMounted } from 'vue'
import { apiGet, apiPost } from '../../utils/api.js'

const searchForm = reactive({
  orderType: '',
  orderNumber: '',
  collectionStatus: ''
})

const orderList = ref([])
const selectAll = ref(false)
const currentPage = ref(1)
const totalPages = ref(10)
const totalItems = ref(100)
const jumpPage = ref(1)
const showCollectionModal = ref(false)

const collectionForm = reactive({
  amount: '',
  method: '',
  collectionDate: '',
  remark: ''
})

const selectedOrder = ref(null)

const visiblePages = computed(() => {
  const pages = []
  const start = Math.max(1, currentPage.value - 2)
  const end = Math.min(totalPages.value, currentPage.value + 2)
  for (let i = start; i <= end; i++) {
    pages.push(i)
  }
  return pages
})

const searchOrders = async () => {

  await loadOrderData()
}

const resetSearch = async () => {
  searchForm.orderType = ''
  searchForm.orderNumber = ''
  searchForm.collectionStatus = ''
  await loadOrderData()
}

const toggleSelectAll = () => {
  orderList.value.forEach(order => {
    order.selected = selectAll.value
  })
}

const toggleRowSelect = (order, event) => {
  const target = event?.target
  if (!target) {
    order.selected = !order.selected
    return
  }
  const tag = target.tagName?.toLowerCase()
  if (tag === 'input' || tag === 'button' || tag === 'a') return
  if (target.closest && target.closest('button')) return
  order.selected = !order.selected
}

const changePage = async (page) => {
  currentPage.value = page
  await loadOrderData()
}

const jumpToPage = async () => {
  if (jumpPage.value >= 1 && jumpPage.value <= totalPages.value) {
    currentPage.value = jumpPage.value
    await loadOrderData()
  }
}

const getStatusClass = (status) => {
  switch (status) {
    case 'uncollected': return 'status-uncollected'
    case 'partial': return 'status-partial'
    case 'collected': return 'status-collected'
    default: return ''
  }
}

const submitCollection = async () => {
  try {
    const result = await apiPost('/finance/order-collections/apply', collectionForm.value)

    if (result.code === 0) {
      alert(result.message || '收款申请提交成功')
      showCollectionModal.value = false
      // 重置表单
      collectionForm.value = {
        amount: '',
        method: '',
        collectionDate: '',
        remark: ''
      }
      selectedOrder.value = null
      // 重新加载数据
      await loadOrderData()
    } else {
      alert(result.message || '收款申请提交失败')
    }
  } catch (error) {
    console.error('提交收款申请时出错:', error)
    alert('提交收款申请时出错')
  }
}

const openCollectionModal = (order) => {
  selectedOrder.value = order
  showCollectionModal.value = true
  // 重置表单
  collectionForm.value = {
    amount: '',
    method: '',
    collectionDate: new Date().toISOString().split('T')[0],
    remark: ''
  }
}

const loadOrderData = async () => {
  try {
    const params = new URLSearchParams({
      page: currentPage.value,
      size: 10,
      ...(searchForm.orderType && { orderType: searchForm.orderType }),
      ...(searchForm.orderNumber && { orderNumber: searchForm.orderNumber }),
      ...(searchForm.collectionStatus && { collectionStatus: searchForm.collectionStatus })
    })

    const data = await apiGet(`/finance/order-collections?${params}`)

    let allOrders = []
    if (data.content) {
      allOrders = data.content.map(order => ({
        ...order,
        selected: false
      }))
    } else {
      console.error('加载订单数据失败')
      // 如果API失败，使用模拟数据
      allOrders = Array.from({ length: 13 }, (_, index) => ({
        id: index + 1,
        selected: false,
        orderType: '销售单',
        orderNumber: 'XS001',
        orderDate: '2023-01-03',
        customerName: 'XXX客户',
        responsiblePerson: '夏油杰',
        contactPhone: '13333333333',
        totalAmount: '5000.00',
        pendingAmount: '5000.00',
        status: 'partial',
        statusText: '部分收款',
        remark: '',
        creator: '夏油杰',
        createTime: '2024-08-23'
      }))
    }

    // 前端过滤（如果后端搜索无效）
    if (searchForm.orderType && searchForm.orderType.trim()) {
      allOrders = allOrders.filter(order =>
        order.orderType && order.orderType.toLowerCase().includes(searchForm.orderType.toLowerCase())
      )
    }

    if (searchForm.orderNumber && searchForm.orderNumber.trim()) {
      allOrders = allOrders.filter(order =>
        order.orderNumber && order.orderNumber.toLowerCase().includes(searchForm.orderNumber.toLowerCase())
      )
    }

    if (searchForm.collectionStatus && searchForm.collectionStatus.trim()) {
      allOrders = allOrders.filter(order =>
        order.status && order.status.toLowerCase().includes(searchForm.collectionStatus.toLowerCase())
      )
    }

    // 分页处理
    const startIndex = (currentPage.value - 1) * 10
    const endIndex = startIndex + 10
    orderList.value = allOrders.slice(startIndex, endIndex)

    totalItems.value = allOrders.length
    totalPages.value = Math.ceil(allOrders.length / 10)

  } catch (error) {
    console.error('加载订单数据时出错:', error)
    // 如果网络错误，使用模拟数据
    orderList.value = Array.from({ length: 13 }, (_, index) => ({
      id: index + 1,
      selected: false,
      orderType: '销售单',
      orderNumber: 'XS001',
      orderDate: '2023-01-03',
      customerName: 'XXX客户',
      responsiblePerson: '夏油杰',
      contactPhone: '13333333333',
      totalAmount: '5000.00',
      pendingAmount: '5000.00',
      status: 'partial',
      statusText: '部分收款',
      remark: '',
      creator: '夏油杰',
      createTime: '2024-08-23'
    }))
    totalItems.value = 13
    totalPages.value = 2
  }
}

onMounted(() => {
  loadOrderData()
})
</script>

<style scoped>
.order-collection {
  padding: 20px;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  position: relative;
}

.order-collection::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}

.page-header {
  margin-bottom: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 25px 30px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

.page-header h1 {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

.breadcrumb {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.search-action-section {
  background: rgba(255, 255, 255, 0.95);
  padding: 25px 30px;
  border-radius: 16px;
  margin-bottom: 25px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.search-action-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.search-form {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-item label {
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.form-item input,
.form-item select {
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  font-size: 14px;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-item input:focus,
.form-item select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.form-item input:hover,
.form-item select:hover {
  border-color: #adb5bd;
  transform: translateY(-1px);
}

.form-buttons {
  display: flex;
  gap: 10px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  margin-right: 8px;
  font-weight: bold;
  font-size: 16px;
}



.table-pagination-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  margin-bottom: 25px;
}

.table-pagination-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 50%, #43e97b 100%);
}

.table-container {
  overflow-x: auto;
  padding: 20px 20px 0 20px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  backdrop-filter: none;
  position: static;
  overflow: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
  padding: 16px 12px;
  border: none;
  position: relative;
  border-bottom: 2px solid #e9ecef;
}

.data-table tbody tr {
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(225, 229, 233, 0.5);
}

.data-table tbody tr:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.data-table tbody tr.selected-row {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.08) 0%, rgba(32, 201, 151, 0.08) 100%);
  border-left: 4px solid #20c997;
  box-shadow: inset 0 0 0 1px rgba(32, 201, 151, 0.25);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.status-uncollected {
  color: #dc3545;
  font-weight: 600;
  background: rgba(220, 53, 69, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(220, 53, 69, 0.3);
  display: inline-block;
}

.status-partial {
  color: #ffc107;
  font-weight: 600;
  background: rgba(255, 193, 7, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 193, 7, 0.3);
  display: inline-block;
}

.status-collected {
  color: #28a745;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(40, 167, 69, 0.3);
  display: inline-block;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 20px 20px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  backdrop-filter: none;
  position: static;
  overflow: visible;
  border-top: 1px solid #e9ecef;
}

.pagination-info {
  color: #666;
  font-size: 14px;
}

.pagination-controls {
  display: flex;
  gap: 5px;
}

.pagination-jump {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-jump input {
  width: 80px;
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pagination-jump input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
  color: white !important;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4) !important;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.6);
}

.btn-page {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  padding: 10px 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-page:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.btn-page.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 4px 8px;
  font-size: 10px;
}

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid #e1e5e9;
  position: relative;
}

.modal-header {
  padding: 18px 20px 16px 20px;
  border-bottom: 1px solid #e1e5e9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-body {
  padding: 16px 20px;
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

.modal-footer {
  padding: 14px 20px 18px 20px;
  border-top: 1px solid #e1e5e9;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8f9fa;
  border-radius: 0 0 12px 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.3s ease;
  background: #ffffff;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #adb5bd;
}

.form-group textarea {
  height: 60px;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

/* 订单信息区域样式 */
.order-info-section,
.payment-details-section {
  margin-bottom: 24px;
}

.order-info-section h4,
.payment-details-section h4 {
  margin: 0 0 16px 0;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  padding-bottom: 8px;
  border-bottom: 2px solid #e1e5e9;
}

.order-info-table {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e1e5e9;
}

.info-row {
  display: flex;
  margin-bottom: 12px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-right: 16px;
}

.info-item:last-child {
  margin-right: 0;
}

.info-item label {
  font-size: 11px;
  color: #6c757d;
  margin-bottom: 4px;
  font-weight: 500;
}

.info-item span {
  font-size: 13px;
  color: #2c3e50;
  font-weight: 600;
}

/* 必填字段样式 */
.required::after {
  content: '*';
  color: #dc3545;
  margin-left: 4px;
}
</style>
